#!/usr/bin/env python
#-*- coding: utf-8 -*-
import numpy as np
import matplotlib.pyplot as plt


class Graphic:
    def __init__(self,title,xLabel,yLabel):
        self.Color = ['red','green','blue','yellow','violet','magenta']
        self.title = title.encode("latin-1")
        self.xLabel = xLabel.encode("utf-8")
        self.yLabel = yLabel.encode("utf-8")


    '''
    Cria um grafico dos valores(values) passados com a legenda(legend)
    '''
    def drawGraph(self,values,legend,color):
        fig = plt.figure()
        ax = fig.add_subplot(1,1,1)
        N = len(values)
        ind = np.arange(N)
        err = np.std(values)
        ax.bar(ind, values, facecolor=self.Color[color],align='center',yerr=err, ecolor='black')
        
        ax.set_xticks(ind)
        ax.set_xticklabels(legend)
        ax.set_ylabel(self.yLabel)
        ax.set_title(self.title.decode("latin-1"),fontstyle='italic')
        
        fig.autofmt_xdate()
        plt.show()
